#include "cktsat/fraig.h"
#include "util/util.h"
#include "base/cktname.h"

int main( int argc , const char ** argv )
{
   ArgAnalyzer arg ( "fraig <infile:aig> <outfile:aig> [-seed <int:seed>] [-mode <int:mode>]" , argc , argv );
   
   extern void mysrand(unsigned x );
   int mode = 0;

   if( arg["-seed"].setted ) mysrand( atoi( arg["-seed"][0] ));
   if( arg["-mode"].setted ) mode = atoi( arg["-mode"][0] );

   Fraig fr;
   CktName name;

   fr.read_aig( arg[0].c_str() , & name );
   fr.init();
   if( mode == 0 )
      fr.run();
//   else 
//      fr.run2();

   StrashAIG ckt;
   fr.factor( ckt );
   ckt.report();
   ckt.write_aig( arg[1].c_str() , & name);
}
